import hyRequest from '@/service'

// 重置密码
export const reqResetUserPwd = (userId: number) => {
  return hyRequest.post({
    url: `/user/resetPassword/${userId}`,
    isShowMessage: true
  })
}

// 强制下线
export const reqKickOut = (userId: number) => {
  return hyRequest.post({
    url: `/user/kickOut/${userId}`,
    isShowMessage: true
  })
}

// 封号
export const reqBanned = (encryptStr: string) => {
  return hyRequest.post({
    url: `/user/banned`,
    data: { encryptStr },
    isShowMessage: true
  })
}

// 解封
export const reqUntieDisable = (userId: number) => {
  return hyRequest.post({
    url: `/user/untieDisable/${userId}`,
    isShowMessage: true
  })
}

// 批量封禁
export const reqBatchBanned = (encryptStr: string) => {
  return hyRequest.post({
    url: `/user/batch/banned`,
    data: { encryptStr },
    isShowMessage: true
  })
}

// 批量解封
export const reqBatchUntieDisable = (encryptStr: string) => {
  return hyRequest.post({
    url: `/user/batchUntieDisable`,
    data: { encryptStr },
    isShowMessage: true
  })
}

// 下载批量导入用户excel模板
export const getExcelTemplate = () => {
  return hyRequest.get({
    url: `/user/getExcelTemplate`,
    responseType: 'blob',
    isBlob: true
  })
}

// Excel导出
export const getExportedExcel = () => {
  return hyRequest.get({
    url: `/user/exportExcel`,
    responseType: 'blob',
    isBlob: true
  })
}

// Excel导入
export const reqImportExcel = (data: FormData) => {
  return hyRequest.post({
    url: `/user/import/excel`,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data,
    isShowMessage: true
  })
}

// 分配角色
export const reqAssignRole = (encryptStr: string) => {
  return hyRequest.post({
    url: `/user/assignRole`,
    data: { encryptStr },
    isShowMessage: true
  })
}
